package 力扣.链表.交换;

class ListNode {
    int val;
    ListNode next;
    ListNode() {}
    ListNode(int val) { this.val = val; }
    ListNode(int val, ListNode next) { this.val = val; this.next = next; }
}
public class 两两交换链表中的节点24 {

    public ListNode swapPairs(ListNode head) {
        if (head == null || head.next == null){
            return head;
        }
        ListNode mid = head.next;
        head.next = swapPairs(mid.next);;
        mid.next = head;
        return mid;
    }
}
